
#include "stdafx.h"
#include "ParamWindow.h"
#include "LPCSTRArray.h"
#include "dencode.h"

static CParamWindow defaultProp;
const CParamWindow& CParamWindow::defaultValue()
{
	if (!defaultProp.m_initialized)
	{
		defaultProp.m_pos[PROPWindow_PubTimeDelay] = CPoint(101, 111);
		defaultProp.m_pos[PROPWindow_CodeInfo] = CPoint(530, 183);
		defaultProp.m_pos[PROPWindow_CodeShow] = CPoint(706, 481);
		defaultProp.m_pos[PROPWindow_PriceFall] = CPoint(104, 518);
#ifndef _FAN_FAN_
		defaultProp.m_pos[PROPWindow_Flash] = CPoint(101, 183);
#endif
		defaultProp.m_initialized = true;
	}
	return defaultProp;
}

void CParamWindow::readINI(const CINIOperater *oper)
{
	const CParamWindow &def = CParamWindow::defaultValue();
	m_pos[PROPWindow_PubTimeDelay] = oper->GetPoint(section, L"PubTimePosition", def.m_pos[PROPWindow_PubTimeDelay]);
	m_pos[PROPWindow_CodeInfo] = oper->GetPoint(section, L"InfoPosition", def.m_pos[PROPWindow_CodeInfo]);
	m_pos[PROPWindow_CodeShow] = oper->GetPoint(section, L"CodePosition", def.m_pos[PROPWindow_CodeShow]);
	m_pos[PROPWindow_PriceFall] = oper->GetPoint(section, L"PriceFallPosition", def.m_pos[PROPWindow_PriceFall]);
#ifndef _FAN_FAN_
	m_pos[PROPWindow_Flash] = oper->GetPoint(section, L"FlashPosition", def.m_pos[PROPWindow_Flash]);
#endif
}

void CParamWindow::writeINI(CINIOperater *oper) const
{
	oper->WritePoint(section, L"PubTimePosition", &m_pos[PROPWindow_PubTimeDelay]);
	oper->WritePoint(section, L"InfoPosition", &m_pos[PROPWindow_CodeInfo]);
	oper->WritePoint(section, L"CodePosition", &m_pos[PROPWindow_CodeShow]);
	oper->WritePoint(section, L"PriceFallPosition", &m_pos[PROPWindow_PriceFall]);
#ifndef _FAN_FAN_
	oper->WritePoint(section, L"FlashPosition", &m_pos[PROPWindow_Flash]);
#endif
}

void CParamWindow::wrINI(intptr_t id)
{
	CINIOperaterDefault operDefault;
	switch (id)
	{
	case PROPWindow_PubTimeDelay:
		operDefault.WritePoint(section, L"PubTimePosition", &m_pos[PROPWindow_PubTimeDelay]); break;
	case PROPWindow_CodeInfo:
		operDefault.WritePoint(section, L"InfoPosition", &m_pos[PROPWindow_CodeInfo]); break;
	case PROPWindow_CodeShow:
		operDefault.WritePoint(section, L"CodePosition", &m_pos[PROPWindow_CodeShow]); break;
	case PROPWindow_PriceFall:
		operDefault.WritePoint(section, L"PriceFallPosition", &m_pos[PROPWindow_PriceFall]); break;
#ifndef _FAN_FAN_
	case PROPWindow_Flash:
		operDefault.WritePoint(section, L"FlashPosition", &m_pos[PROPWindow_Flash]); break;
#endif
	}
}

CParamWindow::CParamWindow()
{
	SetUseTile(false);
}

void CParamWindow::SetUseTile(bool useTile)
{
	m_UseTile = useTile;
	CLPCWSTRArray ary(section, L'\\');
	swprintf_s(section, L"%s\\%s", ary.str[0], m_UseTile ? L"Tile" : L"Normal");
}



CParamWindowPractice::CParamWindowPractice()
{
	CLPCWSTRArray ary(section, L'\\');
	swprintf_s(section, L"%s\\%s", ary.str[0], L"Practice");
}
